const app = getApp();
var util = require('../../utils/util.js');
Page({
    data: {
        equipmentList:[],
        imgUrl:app.globalData.APIURL + '/img/',
        areaId: '',
        areaName: '',
    },

    onLoad: function (option) {
        this.setData({
            areaId: option.id,
            areaName: option.name,
        })
        wx.setNavigationBarTitle({
            title: option.name
        })
        this.getEquipmentList()

    },
    onPullDownRefresh: function () {
        //下拉刷新 获取列表，重置当前页码
        this.getEquipmentList()
    },
    getEquipmentList: function () {
        wx.showLoading({
            title: '加载中',
        });
        var that = this;
        wx.request({
            url: app.globalData.APIURL + '/vending-admin/operator/getEquipList',
            data: {
                token: app.globalData.token,
                equip_area_id: that.data.areaId,
            },
            // method:'GET',
            header: {
                'content-type': 'application/json' // 默认值
            },
            success: function (res) {
                // 停止刷新
                wx.stopPullDownRefresh();
                wx.hideLoading();
                if(app.requestEro(res.data.success,res.data.msg)){
                    console.log(res.data)
                    that.setData({
                        equipmentList: res.data.equipList
                    })
                }

            },
            fail: function (err) {
                console.log(err);
                wx.hideLoading();
            }
        })
    },




})
;